# # 这是一个循环示例，打印从1到10的数字
# for i in range(1,10+1):
#     print(i,end="\t")
# print("\n")
#
# # 打印从1到10的奇数
# #1为上边界, 10为下边界, 2为步长
# for i in range(1,10+1,2):
#     print(i,end="\t")
# print("\n")
#
# # 打印100以内能被3整除的数
# for i in range(1, 100 + 1):
#     if i % 3 == 0:
#         print(i, end="\t")
# print("\n")
#
# #猜数字游戏
# import random
#
# # 随机生成一个1到100之间的数字
# number = random.randint(1, 100)
#
# # 玩家输入一个数字
#
#
# # 判断输入的数字是否正确
# while True:
#    guss = int(input("请输入一个1到100之间的数字："))
#    if guss>number:
#        print("你猜的数字大了")
#    elif guss<number:
#        print("你猜的数字小了")
#    else:
#      print("恭喜你，你猜对了！")
#      break

# 遍历1到100的整数，查找包含7或能被7整除的数字
# for i in range(1, 100 + 1):
#     # 如果数字i能够被7整除或者包含数字7
#     # if i % 7 == 0 or str(i).find("7") != -1:
#      if i % 7 == 0 or str(i).count('7') >0:
#         print(i,end="\t")
# print("\n")


# #打印菱形
# for i in range(1, 11+1 ,2):
#     print(("*" * i).center(11) )
#     #center()方法:将生成的字符串在总宽度为11的情况下居中对齐。如果字符串长度小于11，左右会填充空格。例如，*会变成   *   （两边各有4个空格）。
# for i in range(9, 0, -2):
#     print(("*" * i).center(11) )
for i in range(1,11+1,2):
     print(("*"*i).center(11))
for i in range(9,0,-2):
         print(("*"*i).center(11))
# # 打印菱形
# for i in range(1, 11 + 1, 2):
#     print(("*" * i).center(11))
# for i in range(9, 0, -2):
#     print(("*" * i).center(11))
# #打印水仙花数
# for num in range(100, 1000):
#     # 获取每位数字
#     a = num // 100
#     b = (num % 100) // 10
#     c = num % 10
#     # 判断是否为水仙花数
#     if a ** 3 + b ** 3 + c ** 3 == num:
#         print(num, end="\t")
# print("\n")
#         # 打印九九乘法表
# for i in range(1, 10):
#         for j in range(1, i + 1):
#             print(i * j, end="\t")
#         print("\n")
# #     # 打印完数


#
#  # 打印质数
# for num in range(2, 100):
#     if num > 1:
#         for i in range(2, num):
#             if (num % i) == 0:
#                 break
#         else:
#                 print(num, end="\t")
# print("\n")
# # 打印斐波那契数列
# a, b = 0, 1
# n_terms = 30  # 设置要打印的斐波那契数列数的项
# print("斐波那契数列前", n_terms, "项为：", end=" ")
#
# for i in range(n_terms):
#     print(a, end="\t")
#     a, b = b, a + b  # 更新 a 和 b 的值
# print()  # 换行
#
# # 打印完数
# def is_perfect_number(num):
#     # 用于存储真因子的和
#     sum_of_divisors = 0
#     for i in range(1, num):
#         if num % i == 0:
#             sum_of_divisors += i
#     return sum_of_divisors == num
## # 设置范围
# for n in range(1, 1001):
#     if is_perfect_number(n):
#         print(n, end="\t")
# print("\n")


#     a = num // 100
#     b = (num % 100) // 10
#     c = num % 10
#     # 判断是否为水仙花数
#     if a ** 3 + b ** 3 + c ** 3 == num:
#         print(num, end="\t")
# # print("\n")
# for i in range(100,1000):
#     a=i//100
#     b=(i%100)//10
#     c=i%10
#     if a**3+b**3+c**3==i:
#         print(i)
# for num in range(2, 100):
#     if num > 1:
#         for i in range(2, num):
#             if (num % i) == 0:
#                 break
#         else:
#                 print(num, end="\t")
# print("\n")
#打印质数
for i in range(2,100):
    for j in range(2,i):
        if i%j==0:
            break
    else:
            print(i,end="\t")
print("\n")

# # 打印完数
def number(num):
    number=0
    for i in range(1,num):
        if num%i==0:
            number+=i
    return number==num
for i in range(1,100):
    if number(i):
        print(i,end="\t")

# # 打印完数
# def is_perfect_number(num):
#     # 用于存储真因子的和
#     sum_of_divisors = 0
#     for i in range(1, num):
#         if num % i == 0:
#             sum_of_divisors += i
#     return sum_of_divisors == num
## # 设置范围
# for n in range(1, 1001):
#     if is_perfect_number(n):
#         print(n, end="\t")
# print("\n")
# # 打印斐波那契数列
# a, b = 0, 1
# n_terms = 30  # 设置要打印的斐波那契数列数的项
# print("斐波那契数列前", n_terms, "项为：", end=" ")
#
# for i in range(n_terms):
#     print(a, end="\t")
#     a, b = b, a + b  # 更新 a 和 b 的值
# print()  # 换行
#

import random
#
# # 随机生成一个1到100之间的数字
# number = random.randint(1, 100)
#
# # 玩家输入一个数字
#
#
# # 判断输入的数字是否正确
# while True:
#    guss = int(input("请输入一个1到100之间的数字："))
#    if guss>number:
#        print("你猜的数字大了")
#    elif guss<number:
#        print("你猜的数字小了")
#    else:
#      print("恭喜你，你猜对了！")
#      break
